package ca.badenhorst.ourtrition.model;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wade on 16/04/14.
 */
public class FoodsEatenInfo {
    List<FoodEatenInfo> foods = new ArrayList<FoodEatenInfo>();
    Nutritions nutritions = new Nutritions();

    public void addFoodEatenInfo(String ndbNo, int amount){
        foods.add(new FoodEatenInfo(ndbNo, amount));
    }

    public void addNutritions(Nutritions _nutritions, double totalGrams){
        for (Nutrition nutrition:_nutritions.getNutrients()){
            double value = nutrition.getValue();
            value = value * totalGrams/100.0;
            nutrition.setValue(value);
        }

        nutritions.addNutritions(_nutritions);
    }

    public Nutritions getNutritions() {
        return nutritions;
    }

    private class FoodEatenInfo{
        int amount;
        String ndbNo;

        private FoodEatenInfo(String ndbNo, int amount) {
            this.amount = amount;
            this.ndbNo = ndbNo;
        }

        public int getAmount() {
            return amount;
        }

        public void setAmount(int amount) {
            this.amount = amount;
        }

        public String getNdbNo() {
            return ndbNo;
        }

        public void setNdbNo(String ndbNo) {
            this.ndbNo = ndbNo;
        }
    }
}
